//
//  YSViewController.m
//  YSDownLoader
//
//  Created by kysonyangs on 12/04/2018.
//  Copyright (c) 2018 kysonyangs. All rights reserved.
//

#import "YSViewController.h"
#import "YSDownLoadManager.h"

/// 学霸的诸天系统
/// http://xiazai.xqishu.com/txt/%E5%AD%A6%E9%9C%B8%E7%9A%84%E8%AF%B8%E5%A4%A9%E7%A9%BF%E8%B6%8A%E7%B3%BB%E7%BB%9F.txt
/// http://xiazai.xqishu.com/rar/%E5%AD%A6%E9%9C%B8%E7%9A%84%E8%AF%B8%E5%A4%A9%E7%A9%BF%E8%B6%8A%E7%B3%BB%E7%BB%9F.rar

/// 雪鹰领主
#define str @"http://xiazai.xqishu.com/txt/%E9%9B%AA%E9%B9%B0%E9%A2%86%E4%B8%BB.txt"
#define str2 @"http://xiazai.xqishu.com/rar/%E9%9B%AA%E9%B9%B0%E9%A2%86%E4%B8%BB.rar"

@interface YSViewController ()

@end

@implementation YSViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (IBAction)download:(id)sender {
    NSURL *url = [NSURL URLWithString:str];
    
    NSURL *url2 = [NSURL URLWithString:str2];

    
    [[YSDownLoadManager shareInstance] downLoadWithURL:url2 downLoadInfo:^(long long totalSize) {
        NSLog(@"下载信息--%lld", totalSize);
    } progress:^(float progress) {
        NSLog(@"下载进度--%f", progress);
    } success:^(NSString *filePath) {
        NSLog(@"下载成功--路径:%@", filePath);
    } failed:^{
        NSLog(@"下载失败了");
    }];
    
    [[YSDownLoadManager shareInstance] downLoadWithURL:url downLoadInfo:^(long long totalSize) {
        NSLog(@"下载信息--%lld", totalSize);
    } progress:^(float progress) {
        NSLog(@"下载进度--%f", progress);
    } success:^(NSString *filePath) {
        NSLog(@"下载成功--路径:%@", filePath);
    } failed:^{
        NSLog(@"下载失败了");
    }];
    
}

- (IBAction)pause:(id)sender {
    [[YSDownLoadManager shareInstance] pauseAll];
}

- (IBAction)cancel:(id)sender {
    [[YSDownLoadManager shareInstance] resumeAll];
}

- (IBAction)cancelClean:(id)sender {
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
